package com.basker.pisces.orm.statement;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;

public class WriteCommand {
    private FieldObject pkFieldObject;
    private Map<String, FieldObject> fields = new LinkedHashMap<String, FieldObject>();

    public WriteCommand(FieldObject pkFieldObject) {
        this.pkFieldObject = pkFieldObject;
    }

    public boolean addField(FieldObject field) {
        String name = field.getName();
        if (!fields.containsKey(name)) {
            fields.put(name, field);
            return true;
        }

        return false;
    }

    public Collection<FieldObject> getFields() {
        return fields.values();
    }

    public String getKey() {
        return fields.keySet().toString();
    }

    public FieldObject getPkFieldObject() {
        return pkFieldObject;
    }
}
